/*     */ package com.lmpop.trade.tb_emailrecord;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import java.io.PrintStream;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Tb_emailrecordInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Tb_emailrecordInfo()
/*     */   {
/*  17 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  26 */     Tb_emailrecord tb_emailrecord = new Tb_emailrecord();
/*  27 */     tb_emailrecord.setSend_id(map.getString("send_id"));
/*  28 */     tb_emailrecord.setCust_id(map.getString("cust_id"));
/*  29 */     tb_emailrecord.setSend_state(map.getString("send_state"));
/*  30 */     tb_emailrecord.setEmail(map.getString("email"));
/*  31 */     tb_emailrecord.setTitle(map.getString("title"));
/*  32 */     tb_emailrecord.setContent(map.getString("content"));
/*  33 */     tb_emailrecord.setSend_date(map.getString("send_date"));
/*  34 */     tb_emailrecord.setUser_id(map.getString("user_id"));
/*  35 */     tb_emailrecord.setRemark(map.getString("remark"));
/*     */ 
/*  37 */     String result_code = "0";
/*     */     try {
/*  39 */       insert(dbmMgr, tb_emailrecord);
/*     */     } catch (ApplicationException e) {
/*  41 */       e.printStackTrace();
/*  42 */       result_code = "1";
/*     */     }
/*  44 */     map.setString("result_code", result_code);
/*  45 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Tb_emailrecord tb_emailrecord)
/*     */     throws ApplicationException
/*     */   {
/*  54 */     dbmMgr.update("insertTb_emailrecord", tb_emailrecord);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  64 */     String pkid_string = map.getString("pkid");
/*  65 */     String result_code = "0";
/*     */     try {
/*  67 */       if (!pkid_string.equals("")) {
/*  68 */         String[] pkStr = pkid_string.split("\\|");
/*  69 */         for (int i = 0; i < pkStr.length; i++) {
/*  70 */           if (pkStr[i].equals("")) continue; delete(dbmMgr, pkStr[i]);
/*     */         }
/*     */       }
/*     */     } catch (ApplicationException e) {
/*  74 */       e.printStackTrace();
/*  75 */       result_code = "1";
/*     */     }
/*  77 */     map.setString("result_code", result_code);
/*  78 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/*  87 */     dbmMgr.update("deleteTb_emailrecord", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  96 */     Tb_emailrecord tb_emailrecord = new Tb_emailrecord();
/*  97 */     tb_emailrecord.setSend_id(map.getString("send_id"));
/*  98 */     tb_emailrecord.setCust_id(map.getString("cust_id"));
/*  99 */     tb_emailrecord.setSend_state(map.getString("send_state"));
/* 100 */     tb_emailrecord.setEmail(map.getString("email"));
/* 101 */     tb_emailrecord.setTitle(map.getString("title"));
/* 102 */     tb_emailrecord.setContent(map.getString("content"));
/* 103 */     tb_emailrecord.setSend_date(map.getString("send_date"));
/* 104 */     tb_emailrecord.setUser_id(map.getString("user_id"));
/* 105 */     tb_emailrecord.setRemark(map.getString("remark"));
/*     */ 
/* 107 */     String result_code = "0";
/*     */     try {
/* 109 */       update(dbmMgr, tb_emailrecord);
/*     */     } catch (ApplicationException e) {
/* 111 */       e.printStackTrace();
/* 112 */       result_code = "1";
/*     */     }
/* 114 */     map.setString("result_code", result_code);
/* 115 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Tb_emailrecord tb_emailrecord)
/*     */     throws ApplicationException
/*     */   {
/* 124 */     dbmMgr.update("updateTb_emailrecord", tb_emailrecord);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 134 */     Tb_emailrecord tb_emailrecord = (Tb_emailrecord)obj;
/* 135 */     Map params = new Hashtable();
/* 136 */     if (start == 0)
/* 137 */       start = 0;
/*     */     else {
/* 139 */       start = (start - 1) * limit;
/*     */     }
/*     */ 
/* 142 */     tb_emailrecord.setStart(Integer.valueOf(start));
/* 143 */     tb_emailrecord.setLimit(Integer.valueOf(limit));
/*     */ 
/* 145 */     return this.queryList.getList("getTb_emailrecordList", tb_emailrecord);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 156 */     Tb_emailrecord tb_emailrecord = (Tb_emailrecord)obj;
/* 157 */     List list = this.queryList.getList("getTb_emailrecordCount", tb_emailrecord);
/* 158 */     int count = 0;
/* 159 */     if ((list != null) && (list.size() > 0)) {
/* 160 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 161 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 162 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 165 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 175 */     return this.queryList.getList("getTb_emailrecordByPk", pk);
/*     */   }
/*     */ 
/*     */   public void recordEmails(List list)
/*     */   {
/* 181 */     System.out.println("recordEmails---------->");
/* 182 */     List taskList = null;
/* 183 */     taskList = list;
/* 184 */     String send_state = "";
/* 185 */     QueryList queryList = new QueryList();
/* 186 */     if ((taskList != null) && (taskList.size() > 0))
/*     */     {
/* 188 */       for (int i = 0; i < taskList.size(); i++) {
/* 189 */         Hashtable map = (Hashtable)taskList.get(i);
/* 190 */         queryList.executeSql("insertNewEmailRecord", map);
/* 191 */         if ((map.get("is_repeat") != null) && (map.get("is_repeat").toString().equals("0"))) {
/* 192 */           queryList.executeSql("delEmailAddrsRecord", map);
/* 193 */           queryList.executeSql("delEmailListRecord", map);
/*     */         }
/*     */       }
/*     */     }
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.tb_emailrecord.Tb_emailrecordInfo
 * JD-Core Version:    0.6.0
 */